package com.ztesoft.sca.common;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.sql.SQLException;

import oracle.sql.CLOB;

/*
 * zxz 
 * 2018-05-22
 * */

public class ClobToStringUtil {
	 // Clob类型 转String
    public static String ClobToString(CLOB clob) throws SQLException, IOException {
      String reString = "";
      Reader is = clob.getCharacterStream();// 得到流
      BufferedReader br = new BufferedReader(is);
      String s = br.readLine();
      StringBuffer sb = new StringBuffer();
      while (s != null) {// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
	      sb.append(s);
	      s = br.readLine();
      }
      reString = sb.toString();
      if(br!=null){
          br.close();
      }
      if(is!=null){
          is.close();
      }
      return reString;
     }
}
